import request from '../utils/request'

export default {
  // 1.更新用户信息
  updateUserInfo ({ id, username, nickname, email }) {
    return request({
      url: '/my/userinfo',
      method: 'put',
      data: {
        id,
        username,
        nickname,
        email,
        user_pic: null
      }
    })
  },

  // 2.更新用户头像
  updateUserAvatar (avatar) {
    return request({
      url: '/my/update/avatar',
      method: 'patch',
      data: {
        avatar
      }
    })
  },

  // 3.更新密码
  updateUserPwd ({ old_pwd, new_pwd, re_pwd }) {
    return request({
      url: '/my/updatepwd',
      method: 'patch',
      data: {
        old_pwd,
        new_pwd,
        re_pwd
      }
    })
  }
}
